//
//  TJUser.m
//  TJSinaWeiBo_OC
//
//  Created by 唐后能 on 16/4/28.
//  Copyright © 2016年 tanghouneng. All rights reserved.
//

#import "TJUser.h"

@implementation TJUser

// 字典转模型.
-(instancetype)initWithDict:(NSDictionary*)dict {
    
    if (self=[super init]) {
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{}

+(instancetype)userWithDict:(NSDictionary*)dict {
    
    return [[self alloc] initWithDict:dict];
}

// 给外界直接使用的属性赋值.
// 给认证图片赋值.
-(void)setVerified_level:(int)verified_level {

    verified_level = verified_level;
    if (verified_level == 0) {
        self.verifiedImage = [UIImage imageNamed:@"avatar_vip"];
    }else if (verified_level == 2 || verified_level == 3 || verified_level == 5) {
    
        self.verifiedImage = [UIImage imageNamed:@"avatar_enterprise_vip"];
    }else if (verified_level == 220 ){
    
        self.verifiedImage = [UIImage imageNamed:@"avatar_grassroot"];
    }else {
    
        self.verifiedImage = nil;
    }
}

// 给会员等级图片赋值.
- (void)setMbrank:(int)mbrank {

    mbrank = mbrank;
    if (mbrank > 0 && mbrank<=6) {
        self.mbrankImage = [UIImage imageNamed:[NSString stringWithFormat:@"common_icon_membership_level%d",mbrank]];
    }else {
        
        self.mbrankImage = nil;
    }
}

@end
